<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <title>使用 className 属性</title>
    <style>
        #divAdvert {
            font: 12pt arial;
        }

        .new-style {
            font-style: italic;
            text-decoration: underline;
        }
    </style>
</head>
<body>
<div id="divAdvert">Here is an advertisement.</div>
<script>
    var divAdvert = document.getElementById('divAdvert');
    divAdvert.className = 'new-style';
</script>
</body>
</html>